package com.bwie.controller;
import com.bwie.pojo.Type;
import com.bwie.service.TypeService;
import com.bwie.service.impl.TypeServiceImpl;
import com.bwie.utils.R;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.multipart.MultipartFile;

/**
* 商品分类表(tb_type)表控制层
*
* @author xxxxx
*/
@RestController
@RequestMapping("/shop/type")
public class TypeController {
/**
* 服务对象
*/
    @Autowired
    private TypeService typeService;

    @ApiOperation("类型垂直树")
    @PostMapping("/getTypeTree")
    public R getTypeTree(){
        return typeService.getTypeTree();
    }

    @ApiOperation("新增类型")
    @PostMapping("/addType")
    public R addType(@RequestBody @Validated Type type){
        return typeService.addType(type);
    }

    @ApiOperation("图片添加")
    @PostMapping("/uploadFileimages")
    public R uploadFileimages(@RequestPart MultipartFile file){
        return typeService.uploadFileimages(file);
    }

    @ApiOperation("树下拉框")
    @PostMapping("/getSelectTypeList")
    public R getSelectTypeList(){
        return typeService.getSelectTypeList();
    }


}
